<ul class="course-wide-list">
  {% for course in courses %}
  <li class="course-item clearfix">
    <a class="course-picture-link" href="{{ path('course_show', {id:course.id}) }}">
      <img class="course-picture" src="{{ default_path('coursePicture',course.middlePicture, 'large') }}" alt="{{ course.title }}">
    </a>
    <div class="course-body">
      <h4 class="course-title"><a href="{{ path('course_show', {id:course.id}) }}">{{ course.title }}</a>
      {% if course.serializeMode=='serialize' %}
        <span class="label label-success ">更新中</span>
      {% elseif course.serializeMode=='finished' %}
        <span class="label label-warning ">已完结</span>
      {% endif %}
      {% if course.type == 'live' %}
          {% set lesson = course['lesson']|default(null) %}
          {% if lesson and "now"|date("U") >= lesson.startTime and "now"|date("U") <= lesson.endTime %}
            <span class="label label-warning series-mode-label">正在直播中</span>
          {% else %}
            <span class="label label-success series-mode-label">直播</span>
          {% endif %}
      {% endif %}
      </h4>

      {% if course.type == 'live' %}
        {% set lesson = course.lesson|default(null) %}
        {% if lesson %}
          <div class="live-course-lesson mbm">
            <span class="text-success fsm mrm">{{ lesson.startTime|date('n月j日 H:i') }} ~ {{ lesson.endTime|date('H:i') }}</span>
            <span class="text-muted fsm mrm">第{{ lesson.number }}课时</span>
          </div>
        {% endif %}
      {% else %}
        <div class="course-about ellipsis">{{ course.subtitle }}</div>
      {% endif %}

      <div class="course-footer clearfix">
        {% set teacher = users[course.teacherIds|first]|default(null) %}
        {% if teacher %}
          <div class="teacher">
            <a href="{{ path('user_show', {id:teacher.id}) }}"><img src="{{ default_path('avatar',teacher.smallAvatar, '') }}" class="teacher-avatar"></a>
            <a class="teacher-nickname ellipsis" href="{{ path('user_show', {id:teacher.id}) }}">{{ teacher.nickname }}</a>
            <span class="teacher-title ellipsis">{{ teacher.title }}</span>
          </div>
        {% endif %}
        <div class="course-metas">
          <span class="stars-{{ (course.rating)|number_format }}">&nbsp;</span>
          <span class="divider"></span>
          {% if course.showStudentNumType == 'opened' %}
          <span class="text-muted mrm mls"><strong>{{ course.studentNum }}</strong>学员</span>
          {% endif %}
          {% if course.price > 0 and free_limit_type(course) == 'free_now' %}
            <span class="free-money-text"><del>{{ course.price }}</del></span>
          {% endif %}
          <span class="course-price">
            {% if course.price > 0 %}
              {% if free_limit_type(course) == 'free_now' %}
                0.00 元
              {% else %}
               价格： {{ course.price }}元
              {% endif %}  
            {% else %}免费{% endif %}
          </span>
          <div class="countdown-list">
            {% include 'TopxiaWebBundle:Course:countdown.html.twig' with {'course':course} %}
          </div>
          {% if free_limit_type(course) == 'free_now' %}
           <span class="text-muted text-sm">
            到期时间
            <span>{{course.freeEndTime|date('n')}}</span>月
            <span>{{course.freeEndTime|date('d')}}</span>日
            <span>{{course.freeEndTime|date('H')}}</span>时
          </span>
           {% endif %}

        </div>
      </div>
    </div>
  </li>
  {% endfor %}
</ul>